<template>
  <div class="news a">
    <div class="flex-yc">
      <el-image class="img" fit="contain"></el-image>
      <div class="content-font">
        <h3 class="ovf1">某某教授的招生计划</h3>
        <p class="ovf3">
          某某教授的招生计划某某教授的招生计划某某教授的招生计划某某教授的招生计划某某教授的招生计划某某教授的招生计划某某教授的招生计划某某教授的招生计划某某教授的招生计划某某教授的招生计划某某教授的招生计划某某教授的招生计划某某教授的招生计划某某教授的招生计划某某教授的招生计划
        </p>
        <span>2022-06-30</span>
      </div>
    </div>

    <div class="flex-yc btn-wrap" v-if="!isRead">
      <el-button type="primary" link @click="onEdit">编辑</el-button>
      <el-button type="danger" link @click="onDelete">删除</el-button>
    </div>
  </div>
</template>

<script setup lang="ts">
withDefaults(
  defineProps<{
    isRead: boolean
  }>(),
  { isRead: true },
)

const emit = defineEmits<{
  (e: 'onEdit')
  (e: 'onDelete')
}>()
const onEdit = () => {
  emit('onEdit')
}
const onDelete = () => {
  emit('onDelete')
}
</script>

<style scoped lang="scss">
.news {
  display: flex;
  margin-bottom: 25px;
  background-color: #fff;
  .btn-wrap {
    flex: 1;
    background-color: #fff;
    padding: 0 20px;
  }
  .img {
    width: 219px;
    height: 165px;
    margin-right: 20px;
    flex-shrink: 0;
  }

  .content-font {
    display: flex;
    flex-direction: column;
    justify-content: space-around;

    h3 {
      font-size: 22px;
      color: #333;

      &:hover {
        color: $primary;
      }
    }

    p {
      font-size: 14px;
      color: #666;
      display: block;
      margin: 14px 0;
      line-height: 20px;

      &:hover {
        color: $primary;
      }
    }

    span {
      font-size: 14px;
      color: #666;
    }
  }
}
</style>
